<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <div id="app">
      {{msg|houzhui}}
      <br />
      <span>{{msg|qianzhui}}</span>
      <br />
      <span>{{msg|qianzhui|houzhui}}</span>
      <br />
      <span>{{msg|houzhui|qianzhui}}</span>
      <br />
      <span>{{msg|houzhui|qianzhui|daxie}}</span><br />
      <span>{{msg|houzhui|qianzhui|daxie(100)}}</span>
    </div>
    <hr />
    <div id="app2">{{msg2|houzhui}}</div>
    <script src="../lib/vue.js"></script>
    <script src="./myfilter.js"></script>
    <script>
      Vue.filter('houzhui', function (val) {
        console.log('-----', val)
        return val + ':houzhui'
      })

      let vm = new Vue({
        el: '#app',
        data: {
          msg: 'hello filter',
        },
        //此过滤器是局部过滤器
        filters: {
          qianzhui: function (val) {
            return 'qianzhui' + val
          },
        },
      })

      new Vue({
        el: '#app2',
        data: { msg2: '222' },
      })
    </script>
  </body>
</html>
